#include <iostream>
#include <string>
#include <fstream>
#include <vector>
#include <chrono>
#include <iomanip>
#include "Bit.h"
#pragma once

using namespace std;

class Bitstr : Bit
{
public:

	Bitstr(void)
	{
	}

	~Bitstr(void)
	{
	}

	void addstr(string astr, string bstr, string &sumstr)
	{
		char ci = '0';
		char cu;
		char sum = '0';
		int ssize = astr.size();
		sumstr.resize(ssize);
		if(sizeof(astr) == sizeof(bstr))
		{
			for (int i = ssize-1; i >=0; i--)
			{
				add(astr[i], bstr[i], ci, sum, cu);
				ci = cu;
				sumstr[i] = sum;
			}
		}
	}

	void twokomp(string &str)
	{
		int ssize = str.size();
		string plusarn;
		plusarn.resize(ssize);
		bool zerosInBeginning = false;
		//cout << str << endl;
		for (int i = 0; i <=ssize-1; i++)
		{
			str[i] = not(str[i]);

			if(i == ssize-1)
			{
				plusarn[i] = '1';
			}
			else
			{
				plusarn[i] = '0';
			}
			
		}
		addstr(str, plusarn, str);
	}
};